const path = require('path');

const webpack = require('webpack');

const HtmlWebpackPlugin = require('html-webpack-plugin');

const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
    entry: path.join(__dirname, './src/index.js'),
    output: {
        path: path.join(__dirname, '/dist'),
        filename: 'main.js'
    },
    devServer: {
        open: false,
        port: 3000,
        contentBase: 'src',
        hot: true,
        host: "192.168.1.103",//指定ip，实现局域网能够访问
    },
    module: {
        rules: [
            { test: /\.css$/, use: ['style-loader', 'css-loader'] },
            { test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
            { test: /\.vue$/, use: 'vue-loader' },
            { test: /\.ttf$/, use: 'url-loader' },
            { test: /\.(jpg|png|jpeg|gif)$/, use: 'url-loader?limit=flas$name=[hash:8][name].[ext]' },
        ]
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new HtmlWebpackPlugin({
            template: path.join(__dirname, './src/index.html'),
            filename: 'index.html'
        }),
        new VueLoaderPlugin()
    ],
    resolve: {
        alias: {
            // "vue$": "vue/dist/vue.js"
        }
    }
}